package com.bosssoft.springcloud.service.impl;

import com.bosssoft.springcloud.dao.MenuDao;
import com.bosssoft.springcloud.entity.dto.MenuDTO;
import com.bosssoft.springcloud.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class MenuServiceImpl implements MenuService {

    @Resource
    private MenuDao menuDao;

    /***
     * 根据角色id获取相应角色的菜单
     * @param rid 角色id
     * @return 菜单集
     */
    @Override
    public List<MenuDTO> getMenuByRoleId(int rid) {
        return menuDao.getMenuByRoleId(rid);
    }

    /***
     * 添加菜单
     * @param menuDTO 菜单
     * @return
     */
    @Override
    public int addMenu(MenuDTO menuDTO) {
        return menuDao.addMenu(menuDTO);
    }

    /***
     * 根据菜单id移除菜单
     * @param menuId 菜单id
     * @return
     */
    @Override
    public int removeMenu(int menuId) {
        return menuDao.removeMenu(menuId);
    }
}
